﻿<%@ Page Title="Справочник сотрудников" Language="C#" MasterPageFile="~/Root.master" AutoEventWireup="true" CodeFile="worker.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="Server">
    <script src="../Scripts/toolbar.js" type="text/javascript"></script>
    <div class="pageLabel">
        <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Справочник сотрудников" Font-Size="Medium" Theme="iOS">
        </dx:ASPxLabel>
    </div>
    <div style="float: left; margin-left: 10px;">

        <dx:ASPxMenu ID="mMenu" runat="server" EnableViewState="False" EncodeHtml="False" SeparatorWidth="2px" BackColor="Transparent"
            SeparatorHeight="15px" ItemSpacing="1px">
            <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png" />
            <ClientSideEvents ItemClick="function(s, e) { MenuItemClick(e, grd_worker); }" />
            <Items>
                <dx:MenuItem Name="btn_Insert" Text="" ToolTip="Добавить запись" GroupName="grp_edit" BeginGroup="True">
                    <Image Url="~/Images/shared/edit_add.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_edit" Name="btn_edit" Text="" ToolTip="Редактировать запись">
                    <Image Url="~/Images/shared/edit.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Удалит запись">
                    <Image Url="~/Images/shared/editdelete.png">
                    </Image>
                </dx:MenuItem>
                <dx:MenuItem GroupName="grp_settings" Name="btn_column" Text="" ToolTip="Настройка колонок">
                    <Image Url="~/Images/shared/group.png">
                    </Image>
                </dx:MenuItem>
            </Items>
        </dx:ASPxMenu>
    </div>
    <dx:ASPxMenu ID="menu_exp" runat="server" OnItemClick="menu_exp_ItemClick">
        <Items>
            <dx:MenuItem Name="btn_Excel" Text="" ToolTip="Экспорт в Excel">
                <Image Url="~/Images/shared/EXCEL.png">
                </Image>
            </dx:MenuItem>
        </Items>
    </dx:ASPxMenu>
    <div style="margin-right: 10px; margin-left: 10px">
        <dx:ASPxGridView ID="grd_worker" runat="server" AutoGenerateColumns="False" ClientInstanceName="grd_worker"
            DataSourceID="ds_worker" KeyFieldName="CODE" Width="100%" OnRowInserting="grd_worker_RowInserting" OnCellEditorInitialize="grd_worker_CellEditorInitialize" OnDataBound="grd_worker_DataBound" OnRowUpdating="grd_worker_RowUpdating">
            <Columns>
                <dx:GridViewDataTextColumn FieldName="CODE" Caption="Код" ReadOnly="True"
                    VisibleIndex="0" CellStyle-BackColor="#ffffd6" Width="50px">
                    <Settings AllowAutoFilter="False" />
                    <EditFormSettings Visible="False" />
                    <CellStyle BackColor="#CCCCCC"></CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataComboBoxColumn Caption="Контрагент" FieldName="KONTRAGENT" VisibleIndex="2" Width="180px">
                    <PropertiesComboBox DataSourceID="ds_kontr" TextField="NAME" ValueField="CODE" ValueType="System.Int32">
                    </PropertiesComboBox>
                    <EditFormSettings VisibleIndex="0" />
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataTextColumn FieldName="F" VisibleIndex="3" Caption="Фамилия" Visible="False" ShowInCustomizationForm="False">
                    <EditFormSettings Visible="True" VisibleIndex="2" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="I" VisibleIndex="4" Visible="False" Caption="Имя" ShowInCustomizationForm="False">
                    <EditFormSettings Visible="True" VisibleIndex="4" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="O" VisibleIndex="5" Visible="False" Caption="Отчетсво" ShowInCustomizationForm="False">
                    <EditFormSettings Visible="True" VisibleIndex="6" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataComboBoxColumn FieldName="WORKERSTATE" VisibleIndex="6" Caption="Должность">
                    <PropertiesComboBox DataSourceID="ds_wstate" TextField="NAME" ValueField="CODE" ValueType="System.Int32">
                    </PropertiesComboBox>
                    <EditFormSettings ColumnSpan="1" VisibleIndex="1" />
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataTextColumn FieldName="PHONE" VisibleIndex="7" Caption="Телефон">
                    <Settings FilterMode="DisplayText" />
                    <EditFormSettings ColumnSpan="1" VisibleIndex="5" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="EMAIL" VisibleIndex="8" Caption="@email">
                    <Settings FilterMode="DisplayText" />
                    <EditFormSettings ColumnSpan="1" VisibleIndex="3" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="NOTE" VisibleIndex="9" Caption="Прмечание" Width="240px">
                    <Settings AllowAutoFilter="False" />
                    <EditFormSettings VisibleIndex="7" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="PSW" VisibleIndex="10" Visible="False" Caption="Пароль" ShowInCustomizationForm="False">
                    <EditFormSettings VisibleIndex="8" Visible="True" Caption="Пароль" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="FIO" VisibleIndex="1" Caption="ФИО" Width="180px">
                    <Settings FilterMode="DisplayText" />
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
            </Columns>
            <SettingsBehavior AllowFocusedRow="True" ConfirmDelete="True" EnableCustomizationWindow="true" ColumnResizeMode="Control" />
            <SettingsPager AlwaysShowPager="True">
            </SettingsPager>
            <Settings ShowFilterRow="True" HorizontalScrollBarMode="Auto" ShowFooter="True" />
        </dx:ASPxGridView>
    </div>
    <asp:EntityDataSource ID="ds_worker" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableFlattening="False" EntitySetName="WORKER" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ds_wstate" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableFlattening="False" EntitySetName="WORKERSTATE">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ds_kontr" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableFlattening="False" EntitySetName="KONTRAGENT" Select="it.[CODE], it.[NAME]">
    </asp:EntityDataSource>
    <dx:ASPxGridViewExporter ID="grd_export" runat="server" GridViewID="grd_worker"></dx:ASPxGridViewExporter>
</asp:Content>

